using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.ServiceModel;
using System.ServiceModel.Description;
using CinemaLib;
using ValidationController;

namespace BioBookingServer
{
    [ServiceBehavior(
        InstanceContextMode = InstanceContextMode.PerCall,
        ConcurrencyMode = ConcurrencyMode.Multiple,
        UseSynchronizationContext = true)]
    public class BookingService : IBookingService
    {
        /// <summary>
        /// Creates a new user if it doesn't already exist
        /// </summary>
        /// <param name="user">A user that should be created</param>
        public void CreateUser(User user)
        {
            Controller.CreateUser(user);
        }

        /// <summary>
        /// Verify a user login and returns the user if the login was correct
        /// </summary>
        /// <param name="usename">Username</param>
        /// <param name="passcode">Password</param>
        /// <returns>
        /// The requested user if verification was valid otherwise null
        /// </returns>
        public User VerifyUser(string usename, string passcode)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Requests a reservation for a show
        /// </summary>
        /// <param name="show"></param>
        /// <returns>
        /// The requested reservation will show otherwise null
        /// </returns>
        public Reservation BeginReservation(Show show)
        {
            return Controller.BeginReservation(show);
        }

        /// <summary>
        /// Requests an update of their reservation
        /// </summary>
        /// <param name="reservation">Reservation shown</param>
        public void UpdateReservation(Reservation reservation)
        {
            Controller.UpdateReservation(reservation);
        }

        /// <summary>
        /// Requests making an Order for a specific reservation
        /// </summary>
        /// <param name="reservation">The reservation is shown</param>
        public void Order(Reservation reservation)
        {
            Controller.Order(reservation);
        }

        /// <summary>
        /// Requests a cancelation of their reservation
        /// </summary>
        /// <param name="reservationid">Requires their reservation ID</param>
        public void Cancel(string reservationid)
        {
            Controller.Cancel(reservationid);
        }

        /// <summary>
        /// Requests a hall
        /// </summary>
        /// <param name="hallid">Hall ID shown</param>
        /// <param name="showid">Show ID shown</param>
        /// <returns>Returns the Hall and Show ID's</returns>
        public Hall GetHall(int hallid, int showid)
        {
            return Controller.GetHall(hallid, showid);
        }

        /// <summary>
        /// Requests a search of a specific movie
        /// </summary>
        /// <param name="searchword">Entered search word</param>
        /// <param name="searchstarttime">The requested time of when that movie starts</param>
        /// <param name="searchendtime">The requested time of when that movie will end</param>
        /// <returns>Returns a list of movies with similar name, start and end time.</returns>
        public List<Show> GetShow(string searchword, DateTime searchstarttime, DateTime searchendtime)
        {
            return Controller.GetShow(searchword, searchstarttime, searchendtime);
        }

        /// <summary>
        /// Requests a list of movies showing at that current date
        /// </summary>
        /// <param name="hallid">Shows what hall is used</param>
        /// <param name="searchtime">Shows the time of the movie</param>
        /// <returns></returns>
        public List<Show> GetSchedule(string hallid, DateTime searchtime)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Request a list of movies
        /// </summary>
        /// <param name="movie">Movies shown</param>
        /// <param name="searchstarttime">Starting time of the movie</param>
        /// <param name="searchendtime">Endtime of the movie</param>
        /// <returns>Returns a list of movies shown and time</returns>
        public List<Show> GetShowWithMovie(Movie movie, DateTime searchstarttime, DateTime searchendtime)
        {
            return Controller.GetShowWithMovie(movie, searchstarttime, searchendtime);
        }

        /// <summary>
        /// Requests the latest movies added
        /// </summary>
        /// <param name="number">Number of movies that should be returned</param>
        /// <returns>
        /// Returns the latest movies added to the database
        /// </returns>
        public List<Movie> GetNewestMovies(int number)
        {
            return Controller.GetNewestMovies(number);
        }
    }
}
